import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  OneToOne,
  JoinColumn,
} from 'typeorm';
import { WxUser } from '../../wxuser/entities/wxuser.entity';
import { ApiProperty } from '@nestjs/swagger';

@Entity()
export class Doctor {
  @ApiProperty({ description: '医生 ID', example: 1 })
  @PrimaryGeneratedColumn()
  id: number;

  @ApiProperty({ description: '医生姓名', example: '张三' })
  @Column()
  name: string;

  @ApiProperty({ description: '医生学历', example: '本科' })
  @Column()
  education: string;

  @ApiProperty({ description: '医生毕业院校', example: 'XX 大学' })
  @Column()
  graduationSchool: string;

  @ApiProperty({ description: '医生证书名称', example: '执业医师证书' })
  @Column()
  certificateName: string;

  @ApiProperty({
    description: '医生证书文件路径或 URL',
    example: 'https://example.com/certificate.pdf',
  })
  @Column()
  certificateFile: string;

  @ApiProperty({
    description: '审核状态，pending 待审核，approved 已通过，rejected 已拒绝',
    example: 'pending',
  })
  @Column({ default: 'pending' })
  status: 'pending' | 'approved' | 'rejected';

  @ApiProperty({ description: '创建时间', example: '2025-05-08T00:00:00.000Z' })
  @CreateDateColumn()
  createdAt: Date;

  @ApiProperty({ description: '更新时间', example: '2025-05-08T00:00:00.000Z' })
  @UpdateDateColumn()
  updatedAt: Date;

  // 关联用户信息
  @OneToOne(() => WxUser)
  @JoinColumn()
  user: WxUser;
}
